<?php
class pages_tree_1 extends Update_Model_Database_AbstractChange{

	protected $comment="Создание таблицы pages_tree";

	public function up(){
		$sql=
			"CREATE TABLE IF NOT EXISTS pages_tree(
				  id INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id = cid',
				  parent_id INT(11) NOT NULL,
				  `left` INT(11) NOT NULL,
				  `right` INT(11) NOT NULL,
				  level INT(11) NOT NULL,
				  type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
				  PRIMARY KEY (id)
			)
				CHARACTER SET utf8
				COLLATE utf8_general_ci;";
		$this->db->query($sql);
	}

	public function down(){
		$sql='DROP TABLE IF EXISTS pages_tree;';
		$this->db->query($sql);
	}

}